<?php namespace Admin\Controller;

use Hdphp\Controller\Controller;
use Admin\Model\Access;

class AccessController extends Controller
{
    protected $db;

    //构造函数
    public function __init()
    {
        $this->db = new Access();
    }

    //动作
    public function index()
    {
        $access = $this->db->getRoleAccess($_GET['role_id']);
//        p($access);
        $nodeModel = new \Admin\Model\Node;
        $node = $nodeModel->getLevelNodel();
//        p($node);
        View::with('access', $access)->with('node',$node);
        View::make();
    }
    //设置权限
    public function set()
    {
        if($this->db->set())
        {
            $this->success('操作成功','Role/index');
        }
        else
        {
            $this->error($this->getError());
        }

    }
}
